package cn.huiyunche.bms.web.controller;

import cn.huiyunche.bms.backend.service.OrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by houjianhui on 2017/9/1.
 */
@Controller
@RequestMapping(value = "/order")
public class OrderController {

    private static final Logger LOGGER = LoggerFactory.getLogger(OrderController.class);

    @Autowired
    private OrderService orderService;


    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public String getOrderById(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) throws Exception {
        LOGGER.info("OrderController.getOrderById param id: {}", id);
        request.setAttribute("order", orderService.getOrderBOById(id));
        return "order";
    }
}
